// ActionScript file
import com.helloniu.fl.NCHandler;
import com.helloniu.fl.SOHandler;
import com.helloniu.fl.util.Tool;
import com.helloniu.fl.widget.HNCoreCompnent;

private var ncHandler:NCHandler = null;
private var soHandler:SOHandler = null;
private var _userID:String = null;
private var _inited:Boolean = false;

public function initConnection(ancHandler:NCHandler, asoHandler:SOHandler, auserID:String):void {
	if(_inited) {
		_inited = true;
		return;
	}

	this.ncHandler = ancHandler;
	this.soHandler = asoHandler;
	this._userID = auserID;
	
	var coreComps:Array = [userListPanel, chatPanel, videoPanel];

	for(var i:int = 0; i < coreComps.length; i++) {
    	var coreComp:HNCoreCompnent = coreComps[i] as HNCoreCompnent;

    	if(coreComp == null) {
			Tool.alert("===)))))))))))==" + coreComp);
        	return;
        }

    	coreComp.initConnection(ncHandler, soHandler, _userID);
    }    
}
